package cn.alise.qdp.service.category;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import cn.alise.qdp.mapper.category.CategoryPriceMapper;
import cn.alise.qdp.model.category.CategoryPrice;

/**
 * CategoryPriceService
 * Mon Nov 06 10:20:35 GMT+08:00 2023  CHENH
 */ 
@Service
@Transactional(rollbackFor = Exception.class)
public class CategoryPriceService {

	@Resource(name = "categoryPriceMapper")
	private CategoryPriceMapper categoryPriceMapper;

	/**
	 * 获取指定一条数据
	 */ 
	public CategoryPrice get(CategoryPrice args) {
		List<CategoryPrice> list = this.list(args);
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * 获取列表
	 */ 
	public List<CategoryPrice> list(CategoryPrice args) {
		return this.categoryPriceMapper.list(args);
	}

	/**
	 * 分页列表
	 */ 
	public List<CategoryPrice> page(Map<String, Object> args) {
		return this.categoryPriceMapper.page(args);
	}

	/**
	 * 列表总数
	 */ 
	public int total(CategoryPrice args) {
		return this.categoryPriceMapper.total(args);
	}

	/**
	 * 删除数据
	 */ 
	public int delete(CategoryPrice args) {
		return this.categoryPriceMapper.delete(args);
	}

	/**
	 * 更新数据
	 */ 
	public int save(CategoryPrice args) {
		return this.categoryPriceMapper.insert(args);
	}

	/**
	 * 新增数据
	 */ 
	public int update(CategoryPrice args) {
		return this.categoryPriceMapper.update(args);
	}

}

